#ifndef SIP_HANDLEMGR_HPP__
#define SIP_HANDLEMGR_HPP__

#include <stdint.h>
#include <set>
#include <boost/thread/mutex.hpp>

namespace wtsxsip{

class CSipHandleMgr
{
public:
    CSipHandleMgr(void);

    virtual ~CSipHandleMgr(void);

    uint32_t generateHandle();

    bool recycleHandle(uint32_t hd);

public:

    static const uint32_t INVALID_HANDLE;

private:

    uint32_t m_counter;

    std::set<uint32_t> m_recycler;

    boost::mutex m_RecyclerMutex;
};



}//namespace

#endif


